package kr.hkit.androidcomplete01.ch08;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class HandlerAccessEx extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.d("Activity Life Cycle", "onCreate");
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.ch08_handleraccessex);
		
		final TextView outText = (TextView) findViewById(R.id.text);
		
		LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
		linear.setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction()==MotionEvent.ACTION_DOWN) {
					outText.setText("Touched");
					return true;
				}
				return false;
			}
		});
	}

	//로그캣 이용해서 액티비티 실행 주기 확인 
	//resume이 호출될때 폰 화면에 보입니다. 
	@Override
	protected void onStart() {
		Log.d("Activity Life Cycle", "onStart");
		super.onStart();
	}

	@Override
	protected void onResume() {
		Log.d("Activity Life Cycle", "onResume");
		super.onResume();
	}

	@Override
	protected void onPause() {
		Log.d("Activity Life Cycle", "onPause");
		super.onPause();
	}

	@Override
	protected void onStop() {
		Log.d("Activity Life Cycle", "onStop");
		super.onStop();
	}

	@Override
	protected void onDestroy() {
		Log.d("Activity Life Cycle", "onDestroy");
		super.onDestroy();
	}
	
}
